/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import stealth.GameState;

/**
 * TODO: Implement Button class Javadoc
 * @author Joshua Mabrey
 */
public class Button extends GUIItem {

    public Button(int x, int y, int width, int height, String text, Runnable r) {
        super(text);
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.r = r;
    }

    @Override
    public void reactToClick(int mousex, int mousey) {
        if ((mousex > x && mousex < (x + width + 1)) && (mousey > y && mousey < (y + height + 1))) {
            r.run();
        }
    }

    @Override
    public void reactToHover(int mousex, int mousey) {
        if ((mousex > x && mousex < (x + width + 1)) && (mousey > y && mousey < (y + height + 1))) {
            filled = true;
        } else {
            filled = false;
        }
    }
    boolean filled;
    Runnable r;
}
